#ifndef MEMBER_CENTER_H
#define MEMBER_CENTER_H

#include <map>
#include <string>
#include <winsock.h>
#include "singleMember.h"
#include "messageBase.h"

class memberCenter
{
public:
	~memberCenter();

	int getCountOfMember() const;
	bool isMemberExisted(const std::string &name) const;
	singleMember *getMemberByName(const std::string &name) const;
	const std::map<std::string, singleMember *> *getAddrofMemberList() const;

	singleMember *createMember(const std::string &name, u_long net_addr);
	singleMember *createMember(const std::string &name, u_long net_addr, SOCKET sock);
	bool releaseMember(const std::string &name);
	void releaseAllMember();

	bool sendMessageToAllMember(messageBase *msg);

private:
	std::map<std::string, singleMember *> m_all_member_list;
};

#endif
